/*
 * ksBlockEntry.h
 *
 *  Created on: Aug 3, 2011
 *      Author: wang
 */

#ifndef KSBLOCKENTRY_H_
#define KSBLOCKENTRY_H_
#include "ksDefines.h"
#include <iosfwd>
class ksBlockEntry
{
public:
    ksBlockEntry();
    ~ksBlockEntry();
protected:
    typedef struct _blockEntry
    {
        unsigned short type; //[kBlockTypeMaxLength];
        unsigned short id; //[kBlockIDMaxLength];
        unsigned int offset;
        unsigned int length;
    } BlockEntry;
private:
    BlockEntry _blockEntry;
public:
    int load(unsigned char* data, unsigned int length);
    void save(std::ofstream& out);
public:
    unsigned short type() const;
    unsigned short id() const;
    unsigned int offset() const;
    unsigned int length() const;
    void setId(unsigned short id);
    void setType(unsigned short type);
    void setOffset(unsigned int offset);
    void setLength(unsigned int length);
protected:
    void description();
};

#endif /* KSBLOCKENTRY_H_ */
